package com.thinkgem.jeesite.common.utils;

import java.text.SimpleDateFormat;
import java.util.Date;


/**
 * 各个流水号工具类
 * @author jun
 *
 */
public class SerialNumberUtils {
	
	private static int TX_NUMBER = 0;
	private static int CNT_NUMBER = 0;
	private static int JL_NUMBER = 0;
	private static int EXP_NUMBER = 0;
	private static int WORKSHEET_CODE_NUMBER = 0;
	
	public static void main(String[] args) {
		System.out.println(getTxNum());
	}
	/**
	 * 提现流水号
	 * @return
	 */
	public static synchronized String getTxNum(){
		String cusNumber = "";
		TX_NUMBER += 1;
		SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
		cusNumber = sdf.format(new Date());
		cusNumber+="1";
		for(int i=3-String.valueOf(TX_NUMBER).length();i>0;i--){
			cusNumber += "0";
		}
		return "TX"+cusNumber+String.valueOf(TX_NUMBER);
	}
	
	public static synchronized String getWSNum(String pre){
		if(StringUtils.isBlank(pre)){
			pre = "WS";
		}
		String cusNumber = "";
		WORKSHEET_CODE_NUMBER += 1;
		SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
		cusNumber = sdf.format(new Date());
		cusNumber+="1";
		for(int i=3-String.valueOf(WORKSHEET_CODE_NUMBER).length();i>0;i--){
			cusNumber += "0";
		}
		return pre+cusNumber+String.valueOf(WORKSHEET_CODE_NUMBER);
	}
	

	public static synchronized String getCount(){
		String count = "";
		CNT_NUMBER += 1;
		SimpleDateFormat sdf = new SimpleDateFormat("SSS");
		count = sdf.format(new Date());
		
		return count+String.valueOf(CNT_NUMBER);
	}
	

	public static String getLCNumber(){
		return "F"+getCount();
	}
	
	
	public static synchronized String getJJNum(){
		String cusNumber = "";
		JL_NUMBER += 1;
		SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
		cusNumber = sdf.format(new Date());
		cusNumber+="1";
		for(int i=3-String.valueOf(JL_NUMBER).length();i>0;i--){
			cusNumber += "0";
		}
		return "JL"+cusNumber+String.valueOf(JL_NUMBER);
	}
	
	
	
	public static synchronized String getEENum(){
		String cusNumber = "";
		EXP_NUMBER += 1;
		SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
		cusNumber = sdf.format(new Date());
		cusNumber+="1";
		for(int i=3-String.valueOf(EXP_NUMBER).length();i>0;i--){
			cusNumber += "0";
		}
		return "EE"+cusNumber+String.valueOf(EXP_NUMBER);
	}

}
